package com.liushao.util;

import java.time.LocalDateTime;
import java.util.Date;
import java.time.format.DateTimeFormatter;
import java.util.Random;

/**
 * @ProjectName: alibaba
 * @Package: com.liushao.util
 * @Description: 定义编号辅助类
 * @Author: 陈修华
 * @CreateDate: 2022/8/1 14:38
 * @Version: 1.0
 * Copyright: Copyright (c) 2022
 */
public class LendNoUtils {

    public static String getNo(){
        LocalDateTime time =LocalDateTime.now();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

        String strDate = dtf.format(time);

        String result="";

        Random random = new Random();
        for (int i = 0; i <3 ; i++) {
            result+=random.nextInt(10);

        }
        return strDate+result;
    }


    public  static String getLendNo(){
        return "LEND"+getNo();
    }

    public  static String getLendItemNo(){
        return "INVEST"+getNo();  //贷款
    }

    public  static String getReturnNo(){
        return "RETURN"+getNo();  //还款
    }
    public  static String getReturnItemNo(){
        return "RETURNITEM"+getNo();  //回款
    }

    public  static String getLoanNo(){
        return "LOAN"+getNo();  //放款
    }

    public  static String getWithdrawNo(){
        return "WITHDRAW"+getNo();  //提现
    }


    public  static String getCancelNo(){
        return "CANCEL"+getNo();  //投资
    }

    //交易  transfer
    public  static String getTransNo(){
        return "TRANS"+getNo();  //投资
    }








 /*   public static void main(String[] args) {
        //  20220801144308690
        System.out.println(getNo());
    }*/
}

/*
    public static String getNo(){
        java.util.Date time =java.util.Date.now();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

        String strDate = dtf.format(time);

        String result="";

        Random random = new Random();
        for (int i = 0; i <3 ; i++) {
            result+=random.nextInt(10);

        }
        return strDate+result;
    }


    public  static String getLendNo(){
        return "LEND"+getNo();
    }

    public  static String getLendItemNo(){
        return "INVEST"+getNo();  //贷款
    }

    public  static String getReturnNo(){
        return "RETURN"+getNo();  //还款
    }
    public  static String getReturnItemNo(){
        return "RETURNITEM"+getNo();  //回款
    }

    public  static String getLoanNo(){
        return "LOAN"+getNo();  //放款
    }

    public  static String getWithdrawNo(){
        return "WITHDRAW"+getNo();  //提现
    }


    public  static String getCancelNo(){
        return "CANCEL"+getNo();  //投资
    }

    //交易  transfer
    public  static String getTransNo(){
        return "TRANS"+getNo();  //投资
    }








 *//*   public static void main(String[] args) {
        //  20220801144308690
        System.out.println(getNo());
    }*/
//}
